package com.basic;


import com.business.socialcredit.SocialCreditFactory;
import com.frame.struts.BaseBean;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.ConvertUtils;

import com.frame.struts.ActionContext;
import com.utils.*;

import java.util.Date;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class CorpNameChangeForm extends BaseBean {
    public CorpNameChangeForm() {
    }
    
    static{
        ConvertUtils.register(new DateConverter(), Date.class);
    }
    
	CorpNameChangeEntity cnce = new CorpNameChangeEntity();
	private String oldId = "";
public String addCorpNameChange(){
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		cnce.setQyid(qyid);
		cnce.setOptdate(new Date());
		cnce.setOptrid(CommUtil.getUserId(request));
		cnce.setXh( factory.getNextXh( "qy_mcbg", qyid ) );
		try{
			if(factory.addCorpNameChange(cnce)){
			    response.sendRedirect("/basic/queryCorpmove.jsp");
		    }
			else
			{
				response.sendRedirect("/basic/failed.jsp");
			}
		
		}
		catch (Exception e) {

		}

			return null;
	}
	public String modifyCorpNameChange(){
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		cnce.setQyid(qyid);
		cnce.setOptdate(new Date());
		cnce.setOptrid(CommUtil.getUserId(request));
		cnce.setXh(factory.getNextXh("qy_mcbg", qyid));
		System.out.println("mnad:"+cnce.getQyid());
		factory.deleteCorpNameChange(cnce.getQyid(),Integer.parseInt(this.getOldId()));
		try{
			if(factory.addCorpNameChange(cnce)){
			    response.sendRedirect("/basic/queryCorpmove.jsp");
		    }
			else
			{
				response.sendRedirect("/basic/failed.jsp");
			}
		}
		catch (Exception e) {

		}
			return null;
	}
	public String getOldId(){
		return this.oldId;
	}
	public void setOldId(String oldId){
		this.oldId=oldId;
	}

	/**
	 * @return cnce.getReturns the bgsj.
	 */
	public java.sql.Date getBgsj() {
		return cnce.getBgsj();
	}
	/**
	 * @param bgsj The bgsj to set.
	 */
	public void setBgsj(java.sql.Date bgsj) {
		cnce.setBgsj(bgsj);
	}
	/**
	 * @return cnce.getReturns the bgyy.
	 */
	public String getBgyy() {
		return cnce.getBgyy();
	}
	/**
	 * @param bgyy The bgyy to set.
	 */
	public void setBgyy(String bgyy) {
		cnce.setBgyy(bgyy);
	}
	/**
	 * @return cnce.getReturns the optdate.
	 */
	public Date getOptdate() {
		return cnce.getOptdate();
	}
	/**
	 * @param optdate The optdate to set.
	 */
	public void setOptdate(Date optdate) {
		cnce.setOptdate(optdate);
	}
	/**
	 * @return cnce.getReturns the optrid.
	 */
	public String getOptrid() {
		return cnce.getOptrid();
	}
	/**
	 * @param optrid The optrid to set.
	 */
	public void setOptrid(String optrid) {
		cnce.setOptrid(optrid);
	}
	/**
	 * @return cnce.getReturns the qyid.
	 */
	public String getQyid() {
		return cnce.getQyid();
	}
	/**
	 * @param qyid The qyid to set.
	 */
	public void setQyid(String qyid) {
		cnce.setQyid(qyid);
	}
	/**
	 * @return cnce.getReturns the recstate.
	 */
	public String getRecstate() {
		return cnce.getRecstate();
	}
	/**
	 * @param recstate The recstate to set.
	 */
	public void setRecstate(String recstate) {
		cnce.setRecstate(recstate);
	}
	/**
	 * @return cnce.getReturns the remark.
	 */
	public String getRemark() {
		return cnce.getRemark();
	}
	/**
	 * @param remark The remark to set.
	 */
	public void setRemark(String remark) {
		cnce.setRemark(remark);
	}
	/**
	 * @return cnce.getReturns the xh.
	 */
	public int getXh() {
		return cnce.getXh();
	}
	/**
	 * @param xh The xh to set.
	 */
	public void setXh(int xh) {
		cnce.setXh(xh);
	}
	/**
	 * @return cnce.getReturns the ym.
	 */
	public String getYm() {
		return cnce.getYm();
	}
	/**
	 * @param ym The ym to set.
	 */
	public void setYm(String ym) {
		cnce.setYm(ym);
	}
	public String getGghmc() {
		return cnce.getGghmc();
	}
	public void setGghmc(String gghmc) {
		cnce.setGghmc(gghmc);
	}

}